package com.matt.foundation.constant;

import lombok.Setter;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/7/19
 * *******************************
 */
public class ContractConstant {

    //合同状态
    public enum Status {
        NON_START(0, "未开始"),
        NORMAL(1, "正常"),
        STOP(2, "已终止"),
        END(3, "已结束"),
        BACK_MONEY(4,"待补款"),
    	FREEZE(5,"已冻结");


        @Setter
        private int code;

        @Setter
        private String value;

        Status(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public Status get(int code){
            for (Status status : values()) {
                if (status.codeOf()==code)
                    return status;
            }
            return null;
        }
    }

    //付款状态
    public enum PayStatus {
        NON_PAY(0, "未付清"),
        PAID(1, "已付清");

        @Setter
        private int code;

        @Setter
        private String value;

        PayStatus(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public PayStatus get(int code){
            for (PayStatus status : values()) {
                if (status.codeOf()==code)
                    return status;
            }
            return null;
        }
    }

    //付款方式
    public enum PayType{
        PART(1,"定金"),
        ALL(2,"全款"),
        ONLINE(3,"线上收款");

        @Setter
        private int code;

        @Setter
        private String value;

        PayType(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public PayType get(int code){
            for (PayType payType : values()) {
                if (payType.codeOf()==code)
                    return payType;
            }
            return null;
        }
    }
}
